function isInSegment(x, y, x1, y1, x2, y2 : int64) : boolean;

var
        a, b, c : int64;

begin
        a := y2 - y1;
        b := x1 - x2;
        c := -x1 * a - y1 * b;
        result := ((a * x + b * y + c = 0) and (x >= min(x1, x2)) and
                  (x <= max(x1, x2)) and (y >= min(y1, y2)) and
                  (y <= max(y1, y2)));
end;